/**
 * Copyright (C) 2009 Ignasi Fosch Alonso
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option) any later
 * version.
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 
 * details.
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 * Place, Suite 330, Boston, MA 02111-1307 USA
 *
 * You can reach me by mail at natx@y10k.ws
 * You can reach him by paper mail at:
 * C. LLEIDA, 41-43, 3r 1a
 * El Prat de Llobregat 08820
 * Barcelona, SPAIN
 */
package ws.y10k.goloim.model;

/**
 * @author  natx
 */
public class Product {
	
	/**
	 * @uml.property  name="reference"
	 */
	private String reference;
	/**
	 * @uml.property  name="description"
	 */
	private String description;
	/**
	 * @uml.property  name="details"
	 */
	private String details;
	/**
	 * @uml.property  name="supplier"
	 */
	private String supplier;
	/**
	 * @uml.property  name="unitNetWeight"
	 */
	private double unitNetWeight;
	/**
	 * @uml.property  name="unitGrossWeight"
	 */
	private double unitGrossWeight;
	/**
	 * @uml.property  name="unitsPerBox"
	 */
	private int unitsPerBox;
	/**
	 * @uml.property  name="box"
	 * @uml.associationEnd  
	 */
	private Box box;
	/**
	 * @uml.property  name="boxesPerLayer"
	 */
	private int boxesPerLayer;
	/**
	 * @uml.property  name="layersPerPallet"
	 */
	private int layersPerPallet;
	/**
	 * @uml.property  name="pallet"
	 * @uml.associationEnd  
	 */
	private Pallet pallet;
	/**
	 * @uml.property  name="stackable"
	 */
	private boolean stackable;
	
	public String toString() {
		String stackable = "";
		if ( !this.stackable ) stackable = "not ";
		return "A product referenced " + this.reference
			+ " called " + this.description
			+ " with details " + this.details
			+ " which unit's net weight is " + this.unitNetWeight
			+ " and unit's gross weight is " + this.unitGrossWeight
			+ " with " + this.unitsPerBox + " units per box "
			+ " using " + this.box
			+ " distributed in " + this.boxesPerLayer + " per layer "
			+ " and " + this.layersPerPallet + " layers per pallet "
			+ " on " + this.pallet
			+ " which is " + stackable + "stackable";
	}
	
	public boolean equals(Object otherProduct) {
		boolean isEqual = false;
		
		if ( this.reference.equals(((Product) otherProduct).reference) ) isEqual = true;
		
		return isEqual;
	}
	
	/**
	 * @return  the reference
	 * @uml.property  name="reference"
	 */
	public String getReference() {
		return reference;
	}

	/**
	 * @param reference  the reference to set
	 * @uml.property  name="reference"
	 */
	public void setReference(String reference) {
		this.reference = reference;
	}

	/**
	 * @return  the description
	 * @uml.property  name="description"
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description  the description to set
	 * @uml.property  name="description"
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @return  the details
	 * @uml.property  name="details"
	 */
	public String getDetails() {
		return details;
	}

	/**
	 * @param details  the details to set
	 * @uml.property  name="details"
	 */
	public void setDetails(String details) {
		this.details = details;
	}

	/**
	 * @return  the supplier
	 * @uml.property  name="supplier"
	 */
	public String getSupplier() {
		return supplier;
	}

	/**
	 * @param supplier  the supplier to set
	 * @uml.property  name="supplier"
	 */
	public void setSupplier(String supplier) {
		this.supplier = supplier;
	}

	/**
	 * @return  the unitNetWeight
	 * @uml.property  name="unitNetWeight"
	 */
	public double getUnitNetWeight() {
		return unitNetWeight;
	}

	/**
	 * @param unitNetWeight  the unitNetWeight to set
	 * @uml.property  name="unitNetWeight"
	 */
	public void setUnitNetWeight(double unitNetWeight) {
		this.unitNetWeight = unitNetWeight;
	}

	/**
	 * @return  the unitGrossWeight
	 * @uml.property  name="unitGrossWeight"
	 */
	public double getUnitGrossWeight() {
		return unitGrossWeight;
	}

	/**
	 * @param unitGrossWeight  the unitGrossWeight to set
	 * @uml.property  name="unitGrossWeight"
	 */
	public void setUnitGrossWeight(double unitGrossWeight) {
		this.unitGrossWeight = unitGrossWeight;
	}

	/**
	 * @return  the unitsPerBox
	 * @uml.property  name="unitsPerBox"
	 */
	public int getUnitsPerBox() {
		return unitsPerBox;
	}

	/**
	 * @param unitsPerBox  the unitsPerBox to set
	 * @uml.property  name="unitsPerBox"
	 */
	public void setUnitsPerBox(int unitsPerBox) {
		this.unitsPerBox = unitsPerBox;
	}

	/**
	 * @return  the box
	 * @uml.property  name="box"
	 */
	public Box getBox() {
		return box;
	}

	/**
	 * @param box  the box to set
	 * @uml.property  name="box"
	 */
	public void setBox(Box box) {
		this.box = box;
	}

	/**
	 * @return  the boxesPerLayer
	 * @uml.property  name="boxesPerLayer"
	 */
	public int getBoxesPerLayer() {
		return boxesPerLayer;
	}

	/**
	 * @param boxesPerLayer  the boxesPerLayer to set
	 * @uml.property  name="boxesPerLayer"
	 */
	public void setBoxesPerLayer(int boxesPerLayer) {
		this.boxesPerLayer = boxesPerLayer;
	}

	/**
	 * @return  the layersPerPallet
	 * @uml.property  name="layersPerPallet"
	 */
	public int getLayersPerPallet() {
		return layersPerPallet;
	}

	/**
	 * @param layersPerPallet  the layersPerPallet to set
	 * @uml.property  name="layersPerPallet"
	 */
	public void setLayersPerPallet(int layersPerPallet) {
		this.layersPerPallet = layersPerPallet;
	}

	/**
	 * @return  the pallet
	 * @uml.property  name="pallet"
	 */
	public Pallet getPallet() {
		return pallet;
	}

	/**
	 * @param pallet  the pallet to set
	 * @uml.property  name="pallet"
	 */
	public void setPallet(Pallet pallet) {
		this.pallet = pallet;
	}

	/**
	 * @return  the stackable
	 * @uml.property  name="stackable"
	 */
	public boolean isStackable() {
		return stackable;
	}

	/**
	 * @param stackable  the stackable to set
	 * @uml.property  name="stackable"
	 */
	public void setStackable(boolean stackable) {
		this.stackable = stackable;
	}

	public Product(String reference, String description, String details,
			String supplier, double unitNetWeight, double unitGrossWeight, int unitsPerBox,
			Box box, int boxesPerLayer, int layersPerPallet, Pallet pallet,
			boolean stackable) {
		this.reference = reference;
		this.description = description;
		this.details = details;
		this.supplier = supplier;
		this.unitNetWeight = unitNetWeight;
		this.unitGrossWeight = unitGrossWeight;
		this.unitsPerBox = unitsPerBox;
		this.box = box;
		this.boxesPerLayer = boxesPerLayer;
		this.layersPerPallet = layersPerPallet;
		this.pallet = pallet;
		this.stackable = stackable;
	}

}
